package wisp.game;

//JFC
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.*;

//WISP
import wisp.dataObjects.*;
import wisp.gui.*;


// GTGE
import com.golden.gamedev.Game;
import com.golden.gamedev.GameLoader;
import com.golden.gamedev.object.*;
import com.golden.gamedev.object.Timer;
import com.golden.gamedev.object.background.ImageBackground;
import com.golden.gamedev.engine.timer.*;


public class MainGame extends Game{

	//GAME Variables
	

	private PlayerSprite hero;
    private ObstacleSprite obstacle;
	private ImageBackground background;
	
    private PlayField field;
    
    private SpriteGroup playerGroup, npcGroup, obstaclesGroup, particlesGroup, monstersGroup, aoeGroup, miscGroup, corpseGroup, summonedMonsterGroup;

    private BufferedImage[] particles, monsters, summonedMonster1, summonedMonster2, summonedMonster3;
    private Timer spawnTimer, curseTimer;
    private String summonedMonsterName;
    
    //private ProgressBarSprite bar,bar2,bar3;
    private int monsterCounter = 0;
    private static final int MAXMONSTER=50;
    private static final int AOETIMER=300;
    
    private CharacterSprite selectedSprite = null;
    
    public static final int WALKING=0, STAND=1;
    public static final int UP=0, DOWN=1, LEFT=2, RIGHT=3;
    
    //AoE collision manager
    private AoeHitCollision aoeCollisionMgr;
    private Timer AOEtimer;
    
    //Curse objects
    private boolean curseMode;
    private boolean waitingForCurseReply;
    private Vector curseRequests;
    private CurseRequest currentRequest;
    private Vector<String> battleLogs;
    private WispCharacter wispcharacter;
    //Sample NPC
    private NPC npc_guildmanager;
    
    
    //For friend requests
    private boolean pendingFriendRequests;
    
    

    /* GUI */
    private GUImanager 	frame;	// wisp.gui framework
	private String characterName;
	private String characterClass;

        
	/****************************************************************************/
	/***************************** GAME SKELETON FUNCTIONS **********************/
	/****************************************************************************/

	public void initResources(){
            
//		initialization of game variables
        this.showCursor();
        this.bsGraphics.setWindowTitle("Wisp");
        pendingFriendRequests = false;
        
        spawnTimer = new Timer(2500);
        spawnTimer.setActive(true);
        curseTimer = new Timer (5000);
        curseTimer.setActive(true);
        
        playerGroup = new AdvanceSpriteGroup("Players");
        npcGroup = new AdvanceSpriteGroup("NPCs");
        obstaclesGroup = new AdvanceSpriteGroup("Obstacles");
        particlesGroup = new AdvanceSpriteGroup("Particles");
        miscGroup = new AdvanceSpriteGroup("misc");
        monstersGroup = new AdvanceSpriteGroup("Monsters");
        aoeGroup = new AdvanceSpriteGroup("AOE");
        corpseGroup = new AdvanceSpriteGroup("Corpses");
        summonedMonsterGroup = new AdvanceSpriteGroup("SummonedMonsters");
        
        
        particles = getImages("IMAGES/Sprites/fireball.gif", 1, 1);
        monsters = getImages("IMAGES/Sprites/monster.png",3,1);
        
        summonedMonster1 = getImages("IMAGES/Sprites/curse1.png", 3, 1);
        summonedMonster2 = getImages("IMAGES/Sprites/curse2.png", 3, 1);
        summonedMonster3 = getImages("IMAGES/Sprites/curse3.png", 3, 1);
        
        battleLogs = new Vector<String>();
        background = new ImageBackground(getImage("IMAGES/Background/grass1.png"), 2048, 2048);
        field = new PlayField(background);
        
        /*****************************/
        /*****OBSTACLE SPRITE********/
        obstacle = new ObstacleSprite(getImages("IMAGES/rock.png",1,1), 600, 200);
                  
        /*****************************/
        /*****MAIN CHARACTER SPRITE***/
    	if (characterClass.equals("templar"))
    		hero = new Templar(this.characterName, this, getImages("IMAGES/Sprites/templar.png", 6, 8), 0,0);
    	
    	else if(characterClass.equals("elementalist"))
    		hero = new Heirophant(this.characterName, this, getImages("IMAGES/Sprites/heirophant.png", 3, 8), 0,0);
    		
    	else 
    	    hero = new Elementalist(this.characterName, this, getImages("IMAGES/Sprites/elementalist.png", 6, 8), 0,0);
    	
        //hero = new Templar("Cantabile", this, getImages("IMAGES/Sprites/templar.png", 6, 8), 0,0);
        //hero = new Heirophant("Eizen", this, getImages("IMAGES/Sprites/heirophant.png", 3, 8), 0,0);
      //  hero = new Elementalist("Ahvalon", this, getImages("IMAGES/Sprites/elementalist.png", 6, 8), 0,0);
        hero.setLocation(getWidth()/2-(hero.getWidth()/2), getHeight()/2-(hero.getHeight()/2));
        
        /*****************************/
        /*****NPC SPRITE**************/
        npc_guildmanager = new NPC("Shop Keeper", this, getImages("IMAGES/Sprites/shopkeeper.png",1,1),50,50);
        npc_guildmanager.setLocation(250,250);
        
        npcGroup.add(npc_guildmanager);
        playerGroup.add(hero);
        
  
        /***************************/
        /****collision managers*****/
        /**** & sprite groups*******/
        
        aoeCollisionMgr = new AoeHitCollision(this, hero);
        AOEtimer = new Timer(AOETIMER);
        AOEtimer.setActive(false);
        
        obstaclesGroup.add(obstacle);

        
        field.addGroup(obstaclesGroup);
        field.addGroup(aoeGroup);
        field.addGroup(playerGroup);
        field.addGroup(npcGroup);
        field.addGroup(monstersGroup);
        field.addGroup(corpseGroup);
        field.addGroup(particlesGroup);
        field.addGroup(miscGroup);
        field.addGroup(summonedMonsterGroup);
      
        field.addCollisionGroup(playerGroup, obstaclesGroup, new CharacterObstaclesCollision());   
        
        field.addCollisionGroup(monstersGroup, aoeGroup, aoeCollisionMgr);
        
   //    field.addCollisionGroup(particlesGroup, obstaclesGroup, new ParticleHitCollision(this));            
   //    field.addCollisionGroup(particlesGroup, monstersGroup, new ParticleHitCollision(this));
        
        for(int i=0;i<MAXMONSTER;i++)
            spawnMonster();
            
        /* ====================== GUI INIT ============================= */
        frame = new GUImanager(bsInput, getWidth(), getHeight(), this, hero.getName(), hero);
            
        //give player a skillbar
        hero.configSkillbar(frame.getSkillbar());
        //config skill window
        hero.configSkillWindow(frame.getSkillWindow());
        frame.validateUI();
         

        /****************************/
        // kunwari me nag curse     //
        /****************************/
        //TEMP lang!!!
    //    summonedMonsterName = "Fox Maiden";
        //curseMode = true;
    //    frame.curse("MINAMAHAL NA TAGAPAYO"); //I CURSHE YOU
    //    this.waitingForCurseReply = true; //I WAIT FOR YOUR ANSWEEER
        //and waiting ... 
        
	}
	
	public void update(long elapsedTime){

		CharacterSprite cs;
	    
		/******** AOE check ***************/
		if(AOEtimer.isActive()){
			if(AOEtimer.action(elapsedTime))
			{	
				getAoEGroup().clear();
				aoeCollisionMgr.SetAOEdamage(0);
				AOEtimer.setActive(false);
				
			}
		}
		
		if (curseTimer.action(elapsedTime))
		{
			checkForCurseRequest();
		}
		
		/******** CURSE check ************/
		if(waitingForCurseReply){
			if(frame.curseRequestStatus() == 1){
				//CURSE ACCEPTED!
				curseMode = true;
				currentRequest.editCRequest("yes", "", currentRequest.getCid());
				//CREATE DA MONSTER
		        SummonedMonsterSprite beast = spawnSummonedMonster(summonedMonsterName);
		        //ATTACK DA PLAYAR
		        beast.attack(hero);
		        
		        waitingForCurseReply = false;
			}
			else if(frame.curseRequestStatus() == 2){
				System.out.println("[PLAYER] LOL u.");
				waitingForCurseReply = false;
			}
		}
		
		if(curseMode){
			//disable AoE 
			field.removeCollisionGroup(aoeCollisionMgr);
			field.addCollisionGroup(summonedMonsterGroup, aoeGroup, aoeCollisionMgr);
		}
		
		/*********  FRIEND REQUEST CHECK *****/
		if(pendingFriendRequests){
			Message m = frame.friendRequestStatus();
			if(m != null){
				//FRIEND REQUEST RESULT!
				if(m.accepted == 1){
					System.out.println("[PLAYER] " + m.sender + " added to comrade list");
					pendingFriendRequests = false;
				}
				else if(m.accepted == 2){
					System.out.println("[PLAYER] " + m.sender + " denied to comrade list");
					pendingFriendRequests = false;
				}
				else
					System.out.println("[SYSTEM] FRIEND REQUEST RESULT ERROR!");
			}
		}
		
			
		
		if(!frame.hasClickedUI())
		{
			/******* SELECT CHECKING ************/
		    //check if user selected a monster or npc
	        	
	        //V2
	        if(click())
	        {
	        	if (curseMode == false)
		       	{
		       		//monster select check
		       		for(Sprite s : monstersGroup.getSprites())
		       		{
		       			if(s != null)
		       			{
		       				cs = (CharacterSprite)s;
		       				if(cs.isOnScreen() && cs.isActive())
		       				{
		       					if(checkPosMouse(cs,false))
		       					{
		       						if(selectedSprite == null || selectedSprite != cs)
		       						{
		       							if(selectedSprite != null)
		       								selectedSprite.setSelected(false);
		       							cs.setSelected(true);
		       							hero.setHasTarget(true);
		       							hero.setTarget(cs);
		       						}
		       						cs.clicked();
		       					}
		       					else 
		       					{
		       						if(cs.isSelected()){
		       						cs.setSelected(false);
		       						hero.setHasTarget(false);
		       						hero.setTarget(null);
		       						}
		       					}
		       				}
		       			}
		       		}
		    }//END MONSTER CLICK CHECK
	        		
	        for(Sprite s : summonedMonsterGroup.getSprites())
	        {
	        	if(s != null)
	        		{
	        			cs = (CharacterSprite)s;
	        				
	        			if(cs.isOnScreen() && cs.isActive())
	        			{
	        				if(checkPosMouse(cs,false))
	        				{
	        					if(selectedSprite == null || selectedSprite != cs)
	        					{
	        						if(selectedSprite != null)
	        							selectedSprite.setSelected(false);
	        						cs.setSelected(true);
	        						hero.setHasTarget(true);
	        						hero.setTarget(cs);
	       						}
	      						cs.clicked();
	       					}else {
	       						if(cs.isSelected()){
	       							cs.setSelected(false);
	      							hero.setHasTarget(false);
	       							hero.setTarget(null);
	       						}
	       					}
	       				}
	       			}
	       	}//END summoned monster click check
	        		
	        //npc select check
	        for(Sprite s : npcGroup.getSprites()){
	        	if(s != null){
	        				
	        	cs = (CharacterSprite)s;
	        			
	        	if(cs.isOnScreen() && cs.isActive())
	        	{
	        		if(checkPosMouse(cs,false))
	        				{
	        					if(selectedSprite == null || selectedSprite != cs)
	        					{
	        						if(selectedSprite != null)
	        							selectedSprite.setSelected(false);
	        						cs.setSelected(true);
	        						hero.setHasTarget(true);
	        						hero.setTarget(cs);
	        					}
	        					cs.clicked();
	        				}else {
	        					if(cs.isSelected()){
	        						cs.setSelected(false);
	        						hero.setHasTarget(false);
	        						hero.setTarget(null);
        						}
        					}
        				}
        			}
       		}//END NPC SELECT CHECK
	        		
       		//corpse select check
       		for(Sprite s : corpseGroup.getSprites()){
       			if(s != null)
       			{
	        				
	  				cs = (CharacterSprite)s;
		        				
	   				if(cs.isOnScreen() && cs.isActive())
	   				{
	  					if(checkPosMouse(cs,false))
	   					{
	   						if(selectedSprite == null || selectedSprite != cs)
	   						{
	   							if(selectedSprite != null)
	   								selectedSprite.setSelected(false);
	        							cs.setSelected(true);
	       							hero.setHasTarget(true);
	      							hero.setTarget(cs);
	      						}
	      						cs.clicked();
	       				}else 
	       				{
	       					if(cs.isSelected())
	       					{
	       						cs.setSelected(false);
		        				hero.setHasTarget(false);
		        				hero.setTarget(null);
	       					}
	       				}
	   				}
       			}
       		}//END CORPSE SELECT CHECK
	        	}//END LCLICK CHECK

		        
		        //check if the user inputted a command
		        if(rightClick()){
		        	if(hero.hasTarget())
		        	{
		        		System.out.println("Character target :" + hero.getTarget().getName());
		        		if(hero.getTarget().getType().equals("NPC")){
		        			System.out.println("Player right clicks" + hero.getTarget().getName());
		        			// NPC + right click = TALK :P
		        			((NPC)hero.getTarget()).talk(frame);
		        		}
		        		else if(hero.getTarget().getType().equals("MONSTER")){
		        			hero.getTarget().clicked();
		        			hero.attackTarget();
		        		}
		        		else if(hero.getTarget().getType().equals("Corpse")){
		        			frame.ToggleLootWindow();
		        		}
		        	}
		        }
	        }
	        
	        
	        if (spawnTimer.action(elapsedTime)) {
	            spawnMonster();
	        }
	        
            if(this.keyPressed(KeyEvent.VK_C))
            {
            	frame.ToggleStatWindow();
            	//field.update(elapsedTime);
            	bsInput.refresh();

            }
            
            if(this.keyPressed(KeyEvent.VK_S))
            {
            	frame.ToggleSkillWindow();
            	//field.update(elapsedTime);
            	bsInput.refresh();

            }
            
            if(this.keyPressed(KeyEvent.VK_ESCAPE))
            {
            	frame.ToggleExitWindow();
            	//field.update(elapsedTime);
            	bsInput.refresh();

            }           
            if(this.keyPressed(KeyEvent.VK_J))
            {
            	frame.ToggleKnapsack();
            	bsInput.refresh();

            }
            if(this.keyPressed(KeyEvent.VK_K))
            {
            	
            	frame.getInbox().addMessage("MSG", new Message("Mr.Baldie", "sikret", "LOL LAGOT", "lalala i'm singing!", 0));
            	frame.getInbox().addMessage("NOTICE", new Message("System", "sikret", "Nezi is hot", "nakakapaso!", 0));
            	frame.getInbox().addMessage("MSG", new Message("System", "sikret", "Sheli hot din", "nakakapaso din!", 0));
            	frame.getInbox().addMessage("FRIEND REQUEST", new Message("DA", hero.getName(), "wanna be friends?", "Hi! can I be your friend?", 2));
                bsInput.refresh();

            }   
            if(this.keyPressed(KeyEvent.VK_L))
            {
            	
            	frame.getComradeList().addComrade("enajelly", 0);
            	frame.getComradeList().addComrade("eizen", 1);
            	frame.getComradeList().addComrade("Loxington", 1);
           // 	frame.getComradeList().addComrade("chelseh", 0);

                bsInput.refresh();

            }  
            
	        /**************************************/
	        /****** UPDATE GAME ELEMENTS HERE *****/
            /**************************************/

            field.update(elapsedTime);
            //GUI Update
	        frame.updateEberiting();
	        //hero.update(elapsedTime);
            
            //refresh input buffer?
            bsInput.refresh();
			
	}
	
	public void render(Graphics2D g){
            field.render(g);
            hero.render(g);
            
            //GUI
            frame.render(g);
	}
	
	/****************************************************************************/
	/************************ CUSTOM GAME FUNCTIONS *****************************/
	/****************************************************************************/
    public Sprite createFireball(double x, double y, int direction) {
        Sprite fireball = new FireballSprite(particles,x,y, 0.5, direction,200);
        return fireball;
    }
    public void fire(double x, double y, int direction) {
        particlesGroup.add(createFireball(x,y, direction));
    }
        
    public Sprite createMonster(double x, double y) {
    	return new MonsterSprite("Wicked Wisp", this, monsters, x, y, this);
    }
        
    public SummonedMonsterSprite createSummonedMonster(String name, double x, double y) {
        	
      	if (name.equals("Goblin"))
       		return new SummonedMonsterSprite(name, this, summonedMonster1, x, y, this);
       	else if (name.equals("Troll"))
       		return new SummonedMonsterSprite(name, this, summonedMonster2, x, y, this);
       	else
           	return new SummonedMonsterSprite(name, this, summonedMonster3, x, y, this);
    }
        
    public SummonedMonsterSprite spawnSummonedMonster(String monsterName)
    {
    	summonedMonsterGroup.clear();
        if (curseMode == true)
        {
        	SummonedMonsterSprite sprite = createSummonedMonster(monsterName,getWidth()/2-(hero.getWidth()/2), getHeight()/2-(hero.getHeight()/2)+ 300 );
        	summonedMonsterGroup.add(sprite);
        	return sprite;
        }
        return null;
    }
    
    public void spawnMonster() {
    	monstersGroup.removeInactiveSprites();
        if (monsterCounter < MAXMONSTER) {
        	monstersGroup.add(createMonster(getRandom(0,2048), getRandom(0,2048)));
            monsterCounter++;
        }
    }
    
    public void reduceMonsterCount() {
        monsterCounter--;
    }
        
    public void checkForCurseRequest()
    {
       	CurseRequest checker = new CurseRequest();
       	
       	//how do i know pagwalang request D:
       	curseRequests = checker.viewCRequest(hero.getName());
       	if (curseRequests != null)
       	{
       		if (curseRequests.isEmpty() == false)
       		{
       			System.out.println ("hindi dapat double!");
       		summonedMonsterName = ((CurseRequest)curseRequests.firstElement()).getCmonster();
       		frame.curse(((CurseRequest)curseRequests.firstElement()).getCdoer());
       		currentRequest = ((CurseRequest)curseRequests.firstElement());
       		this.waitingForCurseReply = true;
       		}
       		
       	}
    }
    
    public void endCurseMode()
    {
    	CurseLog log  = new CurseLog();
    	addBattleLog ("Winner si: " + hero.getName());
    	log.addCurseLog1(currentRequest.getCid(), battleLogs);
    	
    	field.removeCollisionGroup(aoeCollisionMgr);
		field.addCollisionGroup(monstersGroup, aoeGroup, aoeCollisionMgr);
    	setCurseMode(false);

    }
        
        public void setCurseMode(boolean value)
        {
        	curseMode = value;
        }
        
    /*********************************************************/
    /*************** GETTERs SETTERs *************************/
    /*********************************************************/
       
    public GUImanager getFrame(){
    	return frame;
    }

	public SpriteGroup getParticleGroup(){
	    return particlesGroup;
	 }
	 	 
	 public SpriteGroup getAoEGroup(){
	 	return aoeGroup;
	}
	 	 
	public SpriteGroup getMiscGroup(){
	 	return miscGroup;
	}
	 	 
	public SpriteGroup getCorpseGroup(){
	 	return corpseGroup;
	}
	public AoeHitCollision getAOEmanager(){
	 	return aoeCollisionMgr;
	}
	 	 
	public Timer getAOEtimer(){
	 	return AOEtimer;
	}
	
	public void addBattleLog(String detail)
	{
		battleLogs.add(detail);
	}
	
	public void resetBattleLog()
	{
		battleLogs.removeAllElements();
	}
	
	public void setPendingFriendRequests(boolean b){
		pendingFriendRequests = b;
	}
	/****************************************************************************/
	/***************************** GAME START POINT *****************************/
	/****************************************************************************/
	
	public void submitCurseRequestFromVW(String defenderName, String monsterName)
	{
		CurseRequest curseReq = new CurseRequest(hero.getName(), defenderName, "yes", CurrentDT.now(), 0, monsterName, "VW-FB");
		curseReq.addCRequest(curseReq);
		
		WispCharacter curser = hero.getWispcharacter();
		
		WispCharacter defender = new WispCharacter();
		defender.viewChar(defenderName);
		
		Statistics defenderStat = new Statistics();
		defenderStat.viewStat(defenderName);
		
		Statistics monsterStat = new Statistics();
		monsterStat.viewStat(monsterName);
		
		God god = new God();
		god.viewCurseInfo(monsterName);
		
		Monster monster = new Monster();
		int monsterId = monster.generateId();
		monster.setMName(monsterName);
		monster.setCHP(god.getMaxHP());
		monster.setMHP(god.getMaxHP());
		monster.setId(monsterId);
		monster.setStatus(0);
		monster.setXC(0);
		monster.setYC(0);
		monster.addMonster(monster);
		
		Actions curseAction = new Actions();
		curseAction.setBattleId(curseReq.getCid());
		curseAction.attackActionM(monster, monsterStat, defenderStat, defender, curser);
		
		Vector<String> logs = curseAction.getMessageLog();
		Iterator logIt = logs.iterator();
		
		CurseLog curseLog = new CurseLog();
		curseLog.addCurseLog1(curseReq.getCid(), logs);		
		
		// compute for favor points
		Random randomizer = new Random(System.currentTimeMillis());
		double baseFP = Math.floor((god.getFavorHR()-god.getFavorLR() * randomizer.nextDouble()) + god.getFavorLR());
		
		double heroFP = 0;
		double maxFP = baseFP;
        double pdamage;
        double lineage = curser.getFPoint();
        
        if (monster.getCHP()<=0 && defender.getCHP() > 0)
        {
            pdamage = 1 - (defender.getCHP()/defender.getMHP());
        
            if ((defender.getFPoint() > 0 && lineage > 0) || (lineage < 0 && defender.getFPoint() < 0)) //lost same lineage
            	baseFP = Math.ceil(pdamage * baseFP) + Math.floor(pdamage * 0.325);
            else //lost different lineage;
            	baseFP = Math.floor(pdamage * baseFP) - Math.ceil(pdamage * 0.325);
            
            if (curser.getFPoint()-baseFP == 0 || baseFP == 0)
            	baseFP++;
            
            if (curser.getFPoint() < 0 && curser.getFPoint()-baseFP >= 0)
            	curser.editCharInfo(curser.getCharactername(), "favorPt", "", -1, 0);
			else if (curser.getFPoint() > 0 && curser.getFPoint()-baseFP <= 0)
				curser.editCharInfo(curser.getCharactername(), "favorPt", "", 1, 0);
			else	
				curser.editCharInfo(curser.getCharactername(), "favorPt", "", curser.getFPoint()-baseFP, 0);
			if (baseFP < 0)
				baseFP = baseFP * -1;
            //out.println("You have lost "+fp+" favor points for losing the battle.");
			heroFP = baseFP;
        }
        else if (monster.getCHP() > 0 && defender.getCHP() <= 0)
        {
            if ((defender.getFPoint() > 0 && lineage > 0) || (lineage < 0 && defender.getFPoint() < 0)) //won same lineage
            {
                pdamage = 1 - (defender.getCHP()/defender.getMHP());
                baseFP = Math.floor(pdamage * baseFP) - Math.ceil(pdamage * 0.325);
                
                if (curser.getFPoint()-baseFP == 0 || baseFP == 0)
                	baseFP++;
                
				if (curser.getFPoint() < 0 && curser.getFPoint()-baseFP >= 0)
					curser.editCharInfo(curser.getCharactername(), "favorPt", "", -1, 0);
				else if (curser.getFPoint() > 0 && curser.getFPoint()-baseFP <= 0)
					curser.editCharInfo(curser.getCharactername(), "favorPt", "", 1, 0);
				else	
					curser.editCharInfo(curser.getCharactername(), "favorPt", "", curser.getFPoint()-baseFP, 0);
				if (baseFP < 0)
					baseFP = baseFP * -1;
				
				heroFP = baseFP;
                //out.println("You have lost "+fp+" favor points for cursing "+defender+" with the same lineage ");
				 //if (c.getFPoint() > 0)
				 //	out.println("Fascia.");
				 //else
				 //	out.println("Bellum.");
            }
            else //won diff lineage
            {
                if (curser.getFPoint()-baseFP == 0 || baseFP == 0)
                	baseFP++;
                
				if (curser.getFPoint() < 0 && curser.getFPoint()+baseFP >= 0)
					curser.editCharInfo(curser.getCharactername(), "favorPt", "", -1, 0);
				else if (curser.getFPoint() > 0 && curser.getFPoint()+baseFP <= 0)
					curser.editCharInfo(curser.getCharactername(), "favorPt", "", 1, 0);
				else	
               		curser.editCharInfo(curser.getCharactername(), "favorPt", "", curser.getFPoint()+baseFP, 0);
				 if (baseFP < 0)
					baseFP = baseFP * -1;
//                 out.println("You have acquired "+fp+" favor points for cursing "+defender+" from the other lineage ");
//				 if (curser.getFPoint() < 0)
//				 	out.println("Fascia.");
//				 else
//				 	out.println("Bellum.");
				 
				 heroFP = baseFP;
            }                 
        }
        
        monster.deleteMonster(monsterId);
        hero.setFavorPoints(heroFP);
		
	}
	public static void main(String[] args) {
		
				MainGame mGame = new MainGame();
				MyGameLoader gl = new MyGameLoader(mGame);
				
				while (gl.startGame() == false);
				if (gl.startGame() == true)
				{
					System.out.println(" lalalalalla ") ;
					GameLoader game = new GameLoader();
					game.setup(mGame, new Dimension(800,600), false);

					game.start();
				}

		}
	
        {distribute = false;}

		public String getCharacterClass() {
			return characterClass;
		}
		public void setCharacterClass(String characterClass) {
			this.characterClass = characterClass;
		}
		public String getCharacterName() {
			return characterName;
		}
		public void setCharacterName(String characterName) {
			this.characterName = characterName;
		}

		public CurseRequest getCurrentRequest() {
			return currentRequest;
		}

		public void setCurrentRequest(CurseRequest currentRequest) {
			this.currentRequest = currentRequest;
		}

}
